package com.alipear.uibase;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.alipear.appbase.BaseApp;

/**
 * Created by zoulinlin on 16/4/4.
 */
public class BaseCommonActivity extends BaseFramgmentActivity {
    public final static String FRAGMENT_CLASS_KEY = "_fragment_class_key";
    private Fragment mCurFragment;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String curClassKey = getIntent().getStringExtra(FRAGMENT_CLASS_KEY);
        mCurFragment = (Fragment)BaseApp.getCurApp().getGlobalParams().remove(curClassKey);
        setContentView(R.layout.activity_common);
        if (mCurFragment != null) {
            FragmentManager fragmentManager =getSupportFragmentManager();
            FragmentTransaction transaction =fragmentManager.beginTransaction();
            transaction.replace(R.id.fragmentPager,mCurFragment);
        //提交修改
            transaction.commit();
        }

    }
}
